<template>
	<view>
		<view class="list">
			<view 
				class="item tp-w690"
				v-for="(item, index) in list"
				:key="index"
				@click="handleGoDetail(item.id)"
			>
				<view class="l-wrap">
					<view class="tit">{{item.title}}</view>
					<view class="date">{{item.time}}</view>
				</view>
				<uni-icons type="arrowright" size="26" color="#999"></uni-icons>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: [],
			};
		},
		onLoad() {
			this.getAnnouncementList()
		},
		methods: {
			getAnnouncementList() {
				this.$http.get(this.$api.getAnnounceList).then(res => {
					if (res.code === 200) {
						this.list = res.data
					}
				})
			},
			handleGoDetail(id) {
				uni.navigateTo({
					url: './announcementDetail?id='+ id
				});
			}
		}
	}
</script>

<style lang="scss" scoped>
.list {
	.item {
		height: 128rpx;
		background-color: #fff;
		padding: 0 30rpx;
		margin-top: 20rpx;
		box-sizing: border-box;
		border-radius: 12rpx;
		display: flex;
		align-items: center;
		justify-content: space-between;
		.l-wrap {
			display: flex;
			flex-direction: column;
			justify-content: space-evenly;
			.tit {
				font-size: 30rpx;
				font-weight: 500;
			}
			.date {
				font-size: 24rpx;
				color: #999;
			}
		}
	}
}
</style>
